(function(){"use strict";BX.namespace("BX.Grid");BX.Grid.Loader=function(t){this.parent=null;this.container=null;this.windowHeight=null;this.tbodyPos=null;this.headerPos=null;this.lastPosTop=null;this.lastBottomPos=null;this.table=null;this.loader=null;this.adjustLoaderOffset=this.adjustLoaderOffset.bind(this);this.init(t)};BX.Grid.Loader.prototype={init:function(t){this.parent=t;this.table=this.parent.getTable();this.loader=new BX.Loader({target:this.getContainer()})},adjustLoaderOffset:function(){this.windowHeight=BX.height(window);this.tbodyPos=BX.pos(this.table.tBodies[0]);this.headerPos=BX.pos(this.table.tHead);var t=window.scrollY;if(this.parent.isIE()){t=document.documentElement.scrollTop}var i=t+this.windowHeight-this.tbodyPos.top;var s=t-this.tbodyPos.top;if(i>this.tbodyPos.bottom-this.tbodyPos.top){i=this.tbodyPos.bottom-this.tbodyPos.top}if(s<this.headerPos.height){s=this.headerPos.height}else{i-=s;i+=this.headerPos.height}requestAnimationFrame(function(){if(s!==this.lastPosTop){this.getContainer().style.transform="translate3d(0px, "+s+"px, 0)"}if(i!==this.lastBottomPos){this.getContainer().style.height=i+"px"}this.lastPosTop=s;this.lastBottomPos=i}.bind(this))},getContainer:function(){if(!this.container){this.container=BX.Grid.Utils.getByClass(this.parent.getContainer(),this.parent.settings.get("classLoader"),true)}return this.container},show:function(){if(!this.loader.isShown()){this.adjustLoaderOffset();this.getContainer().style.display="block";this.getContainer().style.opacity="1";this.getContainer().style.visibility="visible";this.loader.show()}},hide:function(){if(this.loader.isShown()){this.adjustLoaderOffset();this.loader.hide().then(function(){this.getContainer().style.display="none"}.bind(this))}}}})();